package com.sfl.api_backend.utils.Api;

/**
 * @Author szc
 * @create 2023/1/29 21:13
 */
public class RestResult {

        private int code;
        private String message;
        private Object data;

        public RestResult() {
        }

        public RestResult(int code, String message, Object data) {
            this.code = code;
            this.message = message;
            this.data = data;
        }

        public static RestResult success(Object data) {
            return new RestResult(200, "success", data);
        }

        public static RestResult success() {
            return new RestResult(200, "success", null);
        }

        public static RestResult error(int code, String message) {
            return new RestResult(code, message, null);
        }

        public int getCode() {
            return code;
        }

        public void setCode(int code) {
            this.code = code;
        }

        public String getMessage() {
            return message;
        }

        public void setMessage(String message) {
            this.message = message;
        }

        public Object getData() {
            return data;
        }

        public void setData(Object data) {
            this.data = data;
        }
}
